#include<bits/stdc++.h>
#define ONLINE_JUDGE
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 1e6 + 10, INF = 0x3f3f3f3f;

int n = 5, k;
int a[10];

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }

void solve()
{
    int cnt = 0, flag = 0;
    for (int i = 1;i <= n;i++) cin >> a[i];
    cin >> k;

    for (int i = 1;i <= n;i++) {
        if (a[i] != 0) cnt++;
        if (a[i] == k) flag++;
    }

    if (cnt == 0) cout << "1/1000\n";
    else {
        if (flag == 0) cout << "0/1\n";
        else {
            int g = gcd(cnt, flag);
            cout << flag / g << '/' << cnt / g << '\n';
        }
    }
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    cin >> T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}